-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Common static analysis issues #35
Conversation
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.staticanalysis.CommonStaticAnalysis?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some concerns
switch (_case.getType()) { | ||
case Statement: | ||
if (_case.getStatements().isEmpty()) { | ||
// Visit a fake empty statement to ensure that the ConditionNode has a true successor | ||
visit(new J.Empty(randomId(), Space.EMPTY, Markers.EMPTY), p); | ||
} else { | ||
visitStatementList(_case.getStatements(), p); | ||
} | ||
break; | ||
case Rule: | ||
visit(_case.getBody(), p); | ||
breakFlow.add(currentAsBasicBlock()); | ||
current = Collections.emptySet(); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on why what you have is better?
@JLLeitschuh Thanks for your review! I ran a recipe which did all these changes. The switch-to-if is due to https://docs.openrewrite.org/recipes/staticanalysis/minimumswitchcases (RSPEC-1301). Not sure I agree with that particular one either... The lost comments are deficiencies of the respective recipes. I can try to fix these. |
Much appreciated. Can you also restore the lost comments in the meantime? |
|
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.staticanalysis.CommonStaticAnalysis?organizationId=T3BlblJld3JpdGU%3D